Conversation
📝 WalkthroughWalkthroughAdds sparkline support: new MetricSparkline component, a community metrics series React Query hook and API path, and wires sparkline data into MetricCard and CumulativeMetricCard; also updates query keys and OpenAPI schemas. Changes
Sequence Diagram(s)sequenceDiagram
participant Page as Page.client
participant Hook as useCommunityMetricsSeries
participant RQ as React Query
participant API as Backend API
participant Card as MetricCard / CumulativeMetricCard
participant Spark as MetricSparkline
Page->>Hook: call useCommunityMetricsSeries()
Hook->>RQ: register query (COMMUNITY_METRICS_SERIES)
RQ->>API: GET /community-metrics/series
API-->>RQ: return series arrays
RQ-->>Hook: provide CommunityMetricsSeriesData
Hook-->>Page: hook result (series)
Page->>Card: pass sparklineData, sparklineColor, sparklineDates
Card->>Spark: render sparkline with data + dates + color
Spark-->>Spark: invert/scale data, attach tooltips
Spark-->>Card: render sparkline UI
Card-->>Page: display metric card with sparkline
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/react-query-wrapper/ReactQueryWrapper.tsx (1)
559-593: Guard nestedprofileProxyfields to avoid runtime throws.The
ApiProfileMintype defineshandleasstring | null, and even thoughcreated_byandgranted_toare non-optional inApiProfileProxy, the code should defensively guard these nested fields. The current patternif (profileProxy?.created_by.handle && profileProxy.granted_to.handle)uses optional chaining only onprofileProxybut not on the nested fields, risking a runtime throw if the API returns null forcreated_byorgranted_to.Reintroduce nested optional chaining:
Suggested fix
- if (profileProxy?.created_by.handle && profileProxy.granted_to.handle) { + if (profileProxy?.created_by?.handle && profileProxy?.granted_to?.handle) {This applies to both locations (lines 559–593 and 643–690).
🧹 Nitpick comments (2)
openapi.yaml (2)
333-360: Clarify timestamp semantics and ordering.Please document that
since/toare UTC Unix millis and thatsince <= to. Also consider switching the schema type tointeger(formatint64) for timestamps to avoid ambiguity in codegen.
5851-5926: Document array alignment withsteps_start_times.The schema should state that each metric array is the same length as
steps_start_timesand aligned by index. Consider adding descriptions (and optionalminItems) to make this explicit for client validation/codegen.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
openapi.yaml (1)
7650-7675: Fix required/nullable contract foredition_sizeandunminted.
edition_sizeis marked required but nullable, which creates a schema inconsistency. Ifedition_sizecan be null (e.g., for unlimited editions), thenunmintedcannot reliably be calculated as a required non-nullable field. Either:
- Remove
unmintedfrom the required list and mark it nullable, or- Remove
edition_sizefrom the required list (since nullable fields should not be required)Choose based on whether
unmintedcan always be computed deterministically regardless ofedition_sizestate.
🧹 Nitpick comments (1)
openapi.yaml (1)
5963-6038: Document series alignment across arrays.
Clarify that each metric array aligns 1:1 withsteps_start_timesand all arrays are the same length to avoid client-side ambiguity.♻️ Suggested doc tweak
ApiCommunityMetricsSeries: + description: All metric arrays align 1:1 with steps_start_times and share the same length. type: object

Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.